package com.hlg.xboot.exceptions;


/**
 * <p>错误码</p>
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company: 中视数讯</p>
 * <p>Site: www.digi-zones.com</p>
 *
 * @author yangxin
 * @version 1.0
 * @date 2016/8/5
 */
public enum ErrorCode {

    SERVER_OK(1000, "请求成功"),
    LOGIN_SUCCESS(1100, "登录成功"),
    REGISTER_SUCCESS(1200, "注册成功"),

    /**
     * 服务端异常
     */
    SERVER_SYSERR(1001, "系统错误"),
    PARAMETERS_ERROR(1002, "参数异常"),
    NOTFOUND_RECORD_ERROR(1003, "数据不存在"),
    RECORD_DUPLICATE_ERROR(1004, "数据已存在"),
    UPLOAD_ERROR(1005, "文件上传失败"),
    LOGIN_ERROR(1006,"登录失败"),
    API_TOKEN_INVALID(2001,"登录超时"),
    PARAMS_SIGN_VERIFY_ERROR(2003, "参数签名校验失败"),
    VERIFY_CODE_ERROR(2004, "验证码不正确"),
    UNAUTHORIZED_ERROR(2010,"无权限访问"),
    ;

    private int code;

    private String remark;

    ErrorCode(int code, String remark) {
        this.code = code;
        this.remark = remark;
    }

    public String getRemark() {
        return remark;
    }

    public int getCode() {
        return code;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("ErrorCode{");
        sb.append("code=").append(code);
        sb.append(", remark='").append(remark).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
